package com.qzdsoft.erpcloud.service.basic.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qzdsoft.erpcloud.domain.basic.InoutStorage;
import com.qzdsoft.erpcloud.mapper.basic.InoutStorageMapper;
import com.qzdsoft.erpcloud.service.basic.InoutStorageService;
import com.qzdsoft.vo.Response;

/**
 * Created by Admin
 */
@Service
public class BasicInoutStorageServiceImpl implements InoutStorageService {

    @Autowired
    private InoutStorageMapper basicInoutStorageMapper;

    @Override
    public InoutStorage selectById(Integer id) {
        return basicInoutStorageMapper.selectByPrimaryKey(id);
    }

    @Override
    public Response del(Integer id) {
        basicInoutStorageMapper.deleteByPrimaryKey(id);
        return Response.success(null);
    }

    @Override
    public Response saveOrUpd(InoutStorage basicInoutStorage) {
        if(null != basicInoutStorage.getId()){
            basicInoutStorageMapper.updateByPrimaryKey(basicInoutStorage);
        } else {
            basicInoutStorageMapper.insert(basicInoutStorage);
        }
        return Response.success(null);
    }

    @Override
    public Integer selectDataCount(String name, String decode, Integer companyId, Integer isPreinstall, Integer type) {
        return basicInoutStorageMapper.selectDataCount(name, decode, companyId, isPreinstall, type);
    }

    @Override
    public List<InoutStorage> selectData(String name, String decode, Integer companyId, Integer isPreinstall, Integer type, Integer start, Integer pageSize) {
        return basicInoutStorageMapper.selectData(name, decode, companyId, isPreinstall, type, start, pageSize);
    }
}
